
<template>

    <div class="layout">

        <div class="layout-ceiling">

            <div class="layout-ceiling-main">
                <!-- <a href="#"></a> | -->
                <router-link if="" v-if="!showUserName" :to="{path: '/login'}">{{username}}</router-link> <span v-if="showUserName" style="cursor:pointer">{{requesrUserNamer }} <span class="quit" @click="quit">退出</span></span> <i>|</i>

                <router-link :to="{path: '/personal'}" v-if="isLogin">个人中心</router-link> 
               
            </div>

        </div>

    </div>


</template>
<script>

    export default {

       
        data () {
            return {
                requesrUserNamer:'',
                select3: 'day',
                username: '登录/注册',
                showUserName:false,
                modal1: false,
                isLogin:false,
            }
        },
        created() {
            //this.getAuth();
            this.loading();
        },
        methods:{
        	loading(){

                let url_token = window.localStorage.getItem('ccm-token');

            },

            getAuth() {

            	this.$http.get('/member/me').then(ret => {

            		this.showUserName = true;

                    this.isLogin = true;

            		this.requesrUserNamer = ret.data.data.name;
                    this.$store.dispatch('login', ret.data.data);

		        }).catch(err => {
                    this.$Notice.open({
                        title: '请登录..',
                    });
		        	// this.$Message.error( '请登录..');
		        
		        })


            },


            quit(){

            	this.showUserName = false;
            	
            	window.localStorage.removeItem('ccm-token');
                this.$router.push({path:'/login'});
            },
            ok () {

                this.$router.push({path:'/login'});
            },
            cancel () {
                this.$Notice.open({
                    title: '登录有更多优惠..',
                });
                // this.$Message.error( '登录有更多优惠..');
            },
            routeLink(link) {

                this.$router.push({path: link});
             },


        }
    }
</script>

<style>
@import '../assets/css/ccm.css';

</style>

